/*
* @Author: wanghongfucoder
* @Date:   2017-02-16 10:29:45
* @Last Modified by:   wanghongfucoder
* @Last Modified time: 2017-02-16 10:37:25
*/
import java.util.List;

public  class OrCriteria implements Criteria {
	private Criteria criteria;
	private Criteria othercriteria;
	public OrCriteria(Criteria criteria,Criteria othercriteria){
		this.criteria=criteria;
		this.othercriteria=othercriteria;
	}

	public List<Person> meetCriterial(List<Person> persons){
		List<Person> firstCriteriaPersons=criteria.meetCriterial(persons);
		List<Person> othercriteriaPersons=othercriteria.meetCriterial(persons);
		for (Person person : othercriteriaPersons) {
			if (!firstCriteriaPersons.contains(person)) {
				firstCriteriaPersons.add(person);
			}
		}
		return firstCriteriaPersons;
	}
	
}